package com.example.demo.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author yuanye
 * @date 2023/7/23
 * @Description
 */

@Controller
@ResponseBody
public class ReadConfigController {
    @Value("${string.value}")
    private String myString;

    @Value("${int}")
    private int myint;

    @Value("${mynull.value}")
    private Object myNull;

    @Value("${mystr.value}")
    private String myStr1;

    @Value("${mystr.value2}")
    private String myStr2;

    @Value("${mystr.value3}")
    private String myStr3;

    @RequestMapping("/mynull") // localhost:9999/mynull
    public Object myNull() {
        return myNull;
    }

    @RequestMapping("/myint") // localhost:9999/myint
    public int getMyint() {
        return myint;
    }

    @RequestMapping("/mystring")// localhost:9999/mystring
    public String getMyString() {
        return myString;
    }

    @RequestMapping("/mystr")  // localhost:9999/mystr
    public String getMystr() {
        System.out.println(myStr1);
        System.out.println(myStr2);
        System.out.println(myStr3);
        return myStr1;
    }
}
